<html>
<head><meta charset="utf-8"><title>duplicate lints in clippy and rustc · clippy · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/index.html">clippy</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/duplicate.20lints.20in.20clippy.20and.20rustc.html">duplicate lints in clippy and rustc</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="210314622"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/duplicate%20lints%20in%20clippy%20and%20rustc/near/210314622" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matthiaskrgr <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/duplicate.20lints.20in.20clippy.20and.20rustc.html#210314622">(Sep 16 2020 at 20:15)</a>:</h4>
<p>Rustc has a enum variant size differences lint, this seems like it is a less-configurable version of the clippy <code>large_enum_variant</code> lint...?</p>
<p><a href="https://doc.rust-lang.org/beta/rustc/lints/listing/allowed-by-default.html#variant-size-differences">https://doc.rust-lang.org/beta/rustc/lints/listing/allowed-by-default.html#variant-size-differences</a><br>
<a href="https://rust-lang.github.io/rust-clippy/master/index.html#large_enum_variant">https://rust-lang.github.io/rust-clippy/master/index.html#large_enum_variant</a></p>



<a name="210314979"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/duplicate%20lints%20in%20clippy%20and%20rustc/near/210314979" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/duplicate.20lints.20in.20clippy.20and.20rustc.html#210314979">(Sep 16 2020 at 20:18)</a>:</h4>
<p>We should compare these to lints (e.g. enable the rustc lint in the clippy test file) and see how much they overlap. And then uplift the Clippy behahior if necessary and deprecate the Clippy lint.</p>



<a name="210315040"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/duplicate%20lints%20in%20clippy%20and%20rustc/near/210315040" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matthiaskrgr <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/duplicate.20lints.20in.20clippy.20and.20rustc.html#210315040">(Sep 16 2020 at 20:18)</a>:</h4>
<p><a href="https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes">https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes</a> <br>
and<br>
<a href="https://doc.rust-lang.org/beta/rustc/lints/listing/allowed-by-default.html#single-use-lifetimes">https://doc.rust-lang.org/beta/rustc/lints/listing/allowed-by-default.html#single-use-lifetimes</a><br>
also seem similar</p>



<a name="210315480"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/duplicate%20lints%20in%20clippy%20and%20rustc/near/210315480" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/duplicate.20lints.20in.20clippy.20and.20rustc.html#210315480">(Sep 16 2020 at 20:22)</a>:</h4>
<p>I would <em>love</em> for more clippy lints to be in rustc directly :)</p>



<a name="210315508"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/duplicate%20lints%20in%20clippy%20and%20rustc/near/210315508" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/duplicate.20lints.20in.20clippy.20and.20rustc.html#210315508">(Sep 16 2020 at 20:22)</a>:</h4>
<p>although it does lend a bit of urgency to <a href="https://github.com/rust-lang/rust/issues/74704">https://github.com/rust-lang/rust/issues/74704</a> <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span></p>



<a name="210316238"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/duplicate%20lints%20in%20clippy%20and%20rustc/near/210316238" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/duplicate.20lints.20in.20clippy.20and.20rustc.html#210316238">(Sep 16 2020 at 20:28)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/issues/74704">#74704</a> is a hard problem, since one LintPass can have multiple lints (which makes sense for performance and DRY) and only can be skipped, iff <strong>all</strong> lints in the lint pass are allowed. Clippy has a "workaround" for this:</p>
<p><a href="https://github.com/rust-lang/rust-clippy/blob/06f190287848ceeee36be738cbbd8e008f3e7615/clippy_lints/src/utils/mod.rs#L1402">https://github.com/rust-lang/rust-clippy/blob/06f190287848ceeee36be738cbbd8e008f3e7615/clippy_lints/src/utils/mod.rs#L1402</a><br>
<a href="https://github.com/rust-lang/rust-clippy/blob/c493090a8a601baea39a592fdbe199bd64d6db22/clippy_lints/src/wildcard_dependencies.rs#L33">https://github.com/rust-lang/rust-clippy/blob/c493090a8a601baea39a592fdbe199bd64d6db22/clippy_lints/src/wildcard_dependencies.rs#L33</a></p>
<p>Also, this only works for <code>LateLintPass</code>.</p>



<a name="210317489"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/duplicate%20lints%20in%20clippy%20and%20rustc/near/210317489" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/duplicate.20lints.20in.20clippy.20and.20rustc.html#210317489">(Sep 16 2020 at 20:38)</a>:</h4>
<p>thank you!!</p>



<a name="210334017"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/duplicate%20lints%20in%20clippy%20and%20rustc/near/210334017" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matthiaskrgr <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/duplicate.20lints.20in.20clippy.20and.20rustc.html#210334017">(Sep 16 2020 at 23:53)</a>:</h4>
<p>ticket about the duplicate lints: <a href="https://github.com/rust-lang/rust-clippy/issues/6058">https://github.com/rust-lang/rust-clippy/issues/6058</a></p>



<a name="220404308"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/duplicate%20lints%20in%20clippy%20and%20rustc/near/220404308" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/duplicate.20lints.20in.20clippy.20and.20rustc.html#220404308">(Dec 18 2020 at 17:40)</a>:</h4>
<p><span class="user-mention silent" data-user-id="264664">flip1995</span> <a href="#narrow/stream/257328-clippy/topic/duplicate.20lints.20in.20clippy.20and.20rustc/near/210316238">said</a>:</p>
<blockquote>
<p><a href="https://github.com/rust-lang/rust/issues/74704">#74704</a> is a hard problem, since one LintPass can have multiple lints (which makes sense for performance and DRY) and only can be skipped, iff <strong>all</strong> lints in the lint pass are allowed. Clippy has a "workaround" for this:</p>
<p><a href="https://github.com/rust-lang/rust-clippy/blob/06f190287848ceeee36be738cbbd8e008f3e7615/clippy_lints/src/utils/mod.rs#L1402">https://github.com/rust-lang/rust-clippy/blob/06f190287848ceeee36be738cbbd8e008f3e7615/clippy_lints/src/utils/mod.rs#L1402</a><br>
<a href="https://github.com/rust-lang/rust-clippy/blob/c493090a8a601baea39a592fdbe199bd64d6db22/clippy_lints/src/wildcard_dependencies.rs#L33">https://github.com/rust-lang/rust-clippy/blob/c493090a8a601baea39a592fdbe199bd64d6db22/clippy_lints/src/wildcard_dependencies.rs#L33</a></p>
<p>Also, this only works for <code>LateLintPass</code>.</p>
</blockquote>
<p><span class="user-mention" data-user-id="264664">@flip1995</span> I'm confused about your solution - <a href="https://github.com/rust-lang/rust-clippy/blob/c493090a8a601baea39a592fdbe199bd64d6db22/clippy_lints/src/wildcard_dependencies.rs#L33">https://github.com/rust-lang/rust-clippy/blob/c493090a8a601baea39a592fdbe199bd64d6db22/clippy_lints/src/wildcard_dependencies.rs#L33</a> doesn't run the pass if the <em>crate</em> has the warning allowed. But it's possible to allow the warning at the top level and warn in an inner scope: <a href="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=e37470186961c37d46c64bd8ad67b370">https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=e37470186961c37d46c64bd8ad67b370</a>. Clippy gives a lint there, though. What am I missing?</p>



<a name="220404526"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/duplicate%20lints%20in%20clippy%20and%20rustc/near/220404526" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/duplicate.20lints.20in.20clippy.20and.20rustc.html#220404526">(Dec 18 2020 at 17:42)</a>:</h4>
<p>oh I see that lint doesn't have the caching: <a href="https://github.com/rust-lang/rust-clippy/blob/aaed9d99267cccacd99929a0c28c4b0a552cb443/clippy_lints/src/types.rs#L2222">https://github.com/rust-lang/rust-clippy/blob/aaed9d99267cccacd99929a0c28c4b0a552cb443/clippy_lints/src/types.rs#L2222</a></p>



<a name="220405318"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/duplicate%20lints%20in%20clippy%20and%20rustc/near/220405318" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/duplicate.20lints.20in.20clippy.20and.20rustc.html#220405318">(Dec 18 2020 at 17:48)</a>:</h4>
<p>This check is done every time the check function of the lint pass is entered. So it checks the current level of the lint in the current scope</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>